#include <iostream>
#include <signal.h>
#include <unistd.h>

void handler(int sig)
{
    sleep(1);
    std::cout << "Caught signal " << sig << std::endl;
}

int main(int argc, char *argv[])
{
    signal(SIGFPE, handler);
    int a = 100;
    a /= 0;
    while (1)
    {
        sleep(1);
    }
    return 0;
}